package cn.example.service.impl;

import cn.example.pojo.Users;
import cn.example.mapper.UsersMapper;
import cn.example.service.IUsersService;
import cn.example.vo.ResultBean;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author abc
 * @since 2024-12-20
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements IUsersService {

    @Autowired
    UsersMapper usersMapper;

    @Override
    public ResultBean getUser(String username, String password) {

        Users user = usersMapper.selectOne(new QueryWrapper<Users>().eq("username",username)
        .eq("password",password));
        if(user == null){
            return ResultBean.ERROR("登录失败");
        }
        return ResultBean.SUCCESS("登录成功");
    }
}
